<div class="bg-light lter b-b wrapper-md">
    <h4 class="m-n font-thin">订单详情</h4>
    <!--<button onClick="javascript: history.go(-1);" class="btn-back btn btn-dark btn-sm btn-rounded">-->
        <!--返回-->
    <!--</button>-->
</div>
<div class="wrapper-md ng-scope">
    <div class="panel-body bg-white">
        <div ng-controller="ordersViewCtrl">
            <div class="text-center m-b-sm fa-border">
                <div class="panel-body inline">
                    <div class="pos-rlt orders-box-con">
                        <div class="state-box state-box-after" ng-class="{true:'state-box-active'}[orders.status>=0]">
                            <div class="inline w-md">
                                <span class="block h6 m-b-sm">买家下单</span>
                                <div class="state-box-item m-b-sm"><i class="fa" ng-class="{true:'fa-check',false:'fa-times'}[orders.status>=0]"></i></div>
                                <span class="block h6 font-bold" ng-bind="orders.createdTime==null?'-- --':orders.createdTime"></span>
                            </div>
                        </div>
                        <div class="state-box state-box-before state-box-after" ng-class="{true:'state-box-active'}[orders.status>=1]" ng-if="orders.status!=7">
                            <div class="inline w-md">
                                <span class="block h6 m-b-sm">买家付款</span>
                                <div class="state-box-item m-b-sm"><i class="fa" ng-class="{true:'fa-check',false:'fa-times'}[orders.status>=1]"></i></div>
                                <span class="block h6 font-bold" ng-bind="orders.payTime==null?'-- --':orders.payTime"></span>
                            </div>
                        </div>
                        <div class="state-box state-box-before state-box-after" ng-class="{true:'state-box-active'}[orders.status>=2]" ng-if="orders.type==1 || orders.type==5">
                            <div class="inline w-md">
                                <span class="block h6 m-b-sm">商家接单</span>
                                <div class="state-box-item m-b-sm"><i class="fa" ng-class="{true:'fa-check',false:'fa-times'}[orders.status>=2]"></i></div>
                                <span class="block h6 font-bold" ng-bind="orders.acceptTime==null?'-- --':orders.acceptTime"></span>
                            </div>
                        </div>
                        <div class="state-box state-box-before state-box-after" ng-class="{true:'state-box-active'}[orders.status>=2]" ng-if="orders.status!=7 && orders.status!=8 && orders.status!=9 && orders.status!=4 && orders.status!=5 && orders.type==2">
                            <div class="inline w-md">
                                <span class="block h6 m-b-sm">商家发货</span>
                                <div class="state-box-item m-b-sm"><i class="fa" ng-class="{true:'fa-check',false:'fa-times'}[orders.status>=2]"></i></div>
                                <span class="block h6 font-bold" ng-bind="orders.deliveryTime==null?'-- --':orders.deliveryTime"></span>
                            </div>
                        </div>
                        <div class="state-box state-box-before state-box-after" ng-class="{true:'state-box-active'}[orders.status>=3]" ng-if="orders.status!=7 && orders.status!=8 && orders.status!=9 && orders.status!=4 && orders.status!=5 && orders.type==2">
                            <div class="inline w-md">
                                <span class="block h6 m-b-sm">确认收货</span>
                                <div class="state-box-item m-b-sm"><i class="fa" ng-class="{true:'fa-check',false:'fa-times'}[orders.status==3]"></i></div>
                                <span class="block h6 font-bold" ng-bind="orders.confirmTime==null?'-- --':orders.confirmTime"></span>
                            </div>
                        </div>
                        <div class="state-box state-box-before state-box-after" ng-class="{true:'state-box-active'}[orders.status>=4]" ng-if="orders.status!=7 && orders.status!=8 && orders.status!=9 && orders.type==0">
                            <div class="inline w-md">
                                <span class="block h6 m-b-sm">待使用</span>
                                <div class="state-box-item m-b-sm"><i class="fa" ng-class="{true:'fa-check',false:'fa-times'}[orders.status>=4]"></i></div>
                                <span class="block h6 font-bold" ng-bind="orders.createdTime==null?'-- --':orders.createdTime"></span>
                            </div>
                        </div>

                        <div class="state-box state-box-before state-box-after" ng-class="{true:'state-box-active'}[orders.status>=5]" ng-if="orders.status!=7 && orders.status!=8 && orders.status!=9 && orders.type==0">
                            <div class="inline w-md">
                                <span class="block h6 m-b-sm">已使用</span>
                                <div class="state-box-item m-b-sm"><i class="fa" ng-class="{true:'fa-check',false:'fa-times'}[orders.status>=5]"></i></div>
                                <span class="block h6 font-bold" ng-bind="orders.useTime==null?'-- --':orders.useTime"></span>
                            </div>
                        </div>

                        <div class="state-box state-box-before" ng-class="{true:'state-box-active'}[orders.status==6]" ng-if="orders.status!=7 && orders.status!=8 && orders.status!=9">
                            <div class="inline w-md">
                                <span class="block h6 m-b-sm">交易完成</span>
                                <div class="state-box-item m-b-sm"><i class="fa" ng-class="{true:'fa-check',false:'fa-times'}[orders.status==6]"></i></div>
                                <span class="block h6 font-bold" ng-bind="orders.completeTime==null?'-- --':orders.completeTime"></span>
                            </div>
                        </div>

                        <div class="state-box state-box-before state-box-active-danger" ng-if="orders.status==8">
                            <div class="inline w-md">
                                <span class="block h6 m-b-sm">退货中</span>
                                <div class="state-box-item m-b-sm"><i class="fa fa-times"></i></div>
                                <span class="block h6 font-bold">-- --</span>
                            </div>
                        </div>

                        <div class="state-box state-box-before state-box-active-danger" ng-if="orders.status==9">
                            <div class="inline w-md">
                                <span class="block h6 m-b-sm">退货/退款完成</span>
                                <div class="state-box-item m-b-sm"><i class="fa fa-check"></i></div>
                                <span class="block h6 font-bold">-- --</span>
                            </div>
                        </div>

                        <div class="state-box state-box-before state-box-active-danger" ng-if="orders.status==7">
                            <div class="inline w-md">
                                <span class="block h6 m-b-sm">交易取消</span>
                                <div class="state-box-item m-b-sm"><i class="fa fa-check"></i></div>
                                <span class="block h6 font-bold">-- --</span>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
            <div class="panel-body fa-border">
                <div class="col-sm-4 fa-border">
                    <div class="panel-body">
                        <span class="font-bold h5 block m-b-md m-l-lg">订单信息</span>
                        <div>
                            <table class="orders-info-table">
                                <tr>
                                    <td>
                                        <div class="text-right">
                                            <span class="w-xs inline h6">订单编号：</span>
                                        </div>
                                    </td>
                                    <td>
                                        <span class="h6">{{orders.orderNumber}}</span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="text-right">
                                            <span class="w-xs inline h6">店铺订单编号：</span>
                                        </div>
                                    </td>
                                    <td>
                                        <span class="h6">{{orders.shopOrderNumber}}</span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="text-right">
                                            <span class="w-xs inline h6">微信支付单号：</span>
                                        </div>
                                    </td>
                                    <td>
                                        <span class="h6">{{orders.transactionNumber}}</span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="text-right">
                                            <span class="w-xs inline h6">订单类型：</span>
                                        </div>
                                    </td>
                                    <td>
                                        <span class="h6">普通订单</span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="text-right">
                                            <span class="w-xs inline h6">支付方式：</span>
                                        </div>
                                    </td>
                                    <td>
                                        <span class="h6" ng-if="orders.payWay==0">微信安全支付</span>
                                        <span class="h6" ng-if="orders.payWay==1">现金分支付</span>
                                        <span class="h6" ng-if="orders.payWay==2">收益分支付</span>
                                        <span class="h6" ng-if="orders.payWay==3">会员卡支付</span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="text-right" ng-if="orders.type!=3">
                                            <span class="w-xs inline h6">买家：</span>
                                        </div>
                                        <div class="text-right" ng-if="orders.type==3">
                                            <span class="w-xs inline h6">桌号：</span>
                                        </div>
                                    </td>
                                    <td ng-if="orders.type ==1 || orders.type ==2">
                                        <span class="h6">{{orders.userName}}</span>
                                    </td>
                                    <td ng-if="orders.type == 0">
                                        <span class="h6">{{orders.name}}</span>
                                    </td>
                                    <td ng-if="orders.type == 5 || orders.type == 4">
                                        <span class="h6">{{orders.consumeName}}</span>
                                    </td>
                                    <td ng-if="orders.type == 3">
                                        <span class="h6">{{orders.tableNumber}}</span>
                                    </td>
                                </tr>
                                <tr ng-if="orders.type ==2">
                                    <td>
                                        <div class="text-right">
                                            <span class="w-xs inline h6">物流名称：</span>
                                        </div>
                                    </td>
                                    <td>
                                        <span class="h6" ng-bind="orders.logisticsName==null?'--':orders.logisticsName"></span>
                                    </td>
                                </tr>
                                <tr ng-if="orders.type ==2">
                                    <td>
                                        <div class="text-right">
                                            <span class="w-xs inline h6">物流单号：</span>
                                        </div>
                                    </td>
                                    <td>
                                        <span class="h6" ng-bind="orders.logisticsNumber==null?'--':orders.logisticsNumber">--</span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="text-right">
                                            <span class="w-xs inline h6">订单金额：</span>
                                        </div>
                                    </td>
                                    <td>
                                        <span class="h6">{{orders.realMoney | number:2}} RMB</span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="text-right">
                                            <span class="w-xs inline h6">运费：</span>
                                        </div>
                                    </td>
                                    <td>
                                        <span class="h6" ng-if="orders.postage != 0">{{orders.postage | number:2}} RMB</span>
                                        <span class="h6" ng-if="orders.postage == 0">免运费</span>
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <div class="line line-dashed b-b pull-in"></div>
                        <div>
                            <table class="orders-info-table">
                                <tr>
                                    <td>
                                        <div class="text-right">
                                            <span class="w-xs inline h6">配送方式：</span>
                                        </div>
                                    </td>
                                    <td>
                                        <span class="h6">快递配送</span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="text-right">
                                            <span class="w-xs inline h6">收货地址：</span>
                                        </div>
                                    </td>
                                    <td>
                                        <span class="h6">{{orders.address}}, {{orders.userName}} {{orders.mobilePhone}}</span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div class="text-right">
                                            <span class="w-xs inline h6">备注：</span>
                                        </div>
                                    </td>
                                    <td>
                                        <span class="h6" ng-bind="orders.remark==null?'--':orders.remark"></span>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="col-sm-8 ">
                    <div class="panel-body">
                        <div class="inline orders-info-box">
                            <div class="pull-left">
                                <i class="icon-info h4 m-r-sm"></i>
                            </div>
                            <div class="pull-left">
                                <div ng-if="orders.status==0">
                                    <span class="font-bold m-b-xs block">订单状态：{{orders.statusName}}</span>
                                    <p class="h6 block">买家已下单,暂未付款,如若24小时后 仍未购买 系统自动设置为失效</p>
                                </div>
                                <div ng-if="orders.status==1">
                                    <span class="font-bold m-b-xs block">订单状态：{{orders.statusName}}</span>
                                    <p class="h6 block">买家已付款至微信-乐鸽生态链待结算账户，请尽快发货，否则买家有权申请退款。</p>
                                </div>
                                <div ng-if="orders.status==2">
                                    <span class="font-bold m-b-xs block">订单状态：{{orders.statusName}}</span>
                                    <p class="h6 block">商家已将货物发出,可根据物流单号追踪物流情况。</p>
                                </div>
                                <div ng-if="orders.status==3">
                                    <span class="font-bold m-b-xs block">订单状态：{{orders.statusName}}</span>
                                    <p class="h6 block">用户已确认收货,等待用户评价。</p>
                                </div>
                                <div ng-if="orders.status==4">
                                    <span class="font-bold m-b-xs block">订单状态：{{orders.statusName}}</span>
                                    <p class="h6 block">等待用户使用乐鸽生态链线下卷。</p>
                                </div>
                                <div ng-if="orders.status==5">
                                    <span class="font-bold m-b-xs block">订单状态：{{orders.statusName}}</span>
                                    <p class="h6 block">用户已使用乐鸽生态链线下卷消费。</p>
                                </div>
                                <div ng-if="orders.status==6">
                                    <span class="font-bold m-b-xs block">订单状态：{{orders.statusName}}</span>
                                    <p class="h6 block">交易完成。</p>
                                </div>
                                <div ng-if="orders.status==7">
                                    <span class="font-bold m-b-xs block">订单状态：{{orders.statusName}}</span>
                                    <p class="h6 block">订单交易取消。</p>
                                </div>
                                <div ng-if="orders.status==8">
                                    <span class="font-bold m-b-xs block">订单状态：{{orders.statusName}}</span>
                                    <p class="h6 block">买家发起了退货申请,正在退货当中。</p>
                                </div>
                                <div ng-if="orders.status==9">
                                    <span class="font-bold m-b-xs block">订单状态：{{orders.statusName}}</span>
                                    <p class="h6 block">款项将会1-3工作日内,返还至用户.</p>
                                </div>
                            </div>
                        </div>
                        <div class="line line-dashed b-b pull-in"></div>
                        <div class="panel-body">
                            <span class="h6 block m-b-sm">乐鸽生态链提醒：</span>
                            <span class="h6 block m-b-sm"> 如果无法发货，请及时与买家联系并说明情况后进行退款；</span>
                            <span class="h6 block m-b-sm">买家申请退款后，须征得买家同意后再发货，否则买家有权拒收货物；</span>
                            <span class="h6 block">买家付款后超过7天仍未发货，将有权申请乐鸽生态链介入发起退款维权；</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="panel-body" ng-controller="ordersGoodsListCtrl">
            <table class="table table-striped b-t b-light">
                <thead>
                    <tr>
                        <th>商品图片</th>
                        <th>商品名称</th>
                        <th>类型</th>
                        <th>规格</th>
                        <th>数量</th>
                        <th>价格</th>
                        <th>是否免单商品</th>
                        <th>让利值(%)</th>
                        <th>购买方式</th>
                        <th>退货状态</th>
                        <th>退款状态</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="og in list">
                        <td>
                            <a ui-sref="app.goodsDetail({id:og.goodsId})">
                                <img ng-src="{{app.image.goods}}{{og.fileName}}" err-src="img/error.png" style="height: 50px;width: 50px;">
                            </a>
                        </td>
                        <td class="h6">{{og.goodsName}}</td>
                        <td class="h6">{{og.typeName}}</td>
                        <td class="h6" ng-if="og.standard != null">{{og.standard}}</td>
                        <td class="h6" ng-if="og.standard == null">未开启SKU</td>
                        <td class="h6">{{og.number}}</td>
                        <td class="h6">{{og.price}}</td>
                        <td class="h6">
                            <span class="label bg-light" ng-class="{0:'bg-light',1:'bg-danger'}[og.isOpenRebate]" ng-bind="{0:'否',1:'是'}[og.isOpenRebate]"></span>
                        </td>
                        <td class="h6">{{og.profit}}</td>
                        <td>
                            <span class="label bg-success h6" ng-if="og.status==0">购买</span>
                            <span class="label bg-success h6" ng-if="og.status==3">已评价</span>
                        </td>
                        <td ng-if="og.isRefundGoods == 0">
                            <span class="label bg-success">无申请</span>
                        </td>
                        <td ng-if="og.isRefundGoods == 1">
                            <span class="label bg-info" ng-if="og.goodsRefundStatus == 0">申请中</span>
                            <span class="label bg-warning" ng-if='og.goodsRefundStatus==1'>退货中</span>
                            <span class="label bg-danger" ng-if='og.goodsRefundStatus==2'>拒绝退货</span>
                            <i class="m-l-xs fa fa-question-circle text-muted pos-rlt h6" popover-placement="top"
                               popover="拒绝原因：{{og.goodsRefundReason}}" popover-trigger="mouseenter" ng-if="og.goodsRefundStatus==2"></i>
                            <span class="label bg-success" ng-if='og.goodsRefundStatus==3'>退货完成</span>
                        </td>
                        <td ng-if="og.isRefundMoney == 0">
                            <span class="label bg-success" ng-if='og.ordersRefundStatus==null'>无申请</span>
                            <span class="label bg-success" ng-if='og.ordersRefundStatus==5'>退款完成</span>
                        </td>
                        <td ng-if="og.isRefundMoney == 1">
                            <span class="label bg-info" ng-if='og.ordersRefundStatus==0'>申请中</span>
                            <span class="label bg-warning" ng-if='og.ordersRefundStatus==1'>平台审核中</span>
                            <span class="label bg-danger" ng-if='og.ordersRefundStatus==2'>商家拒绝</span>
                            <span class="label bg-primary" ng-if='og.ordersRefundStatus==3'>退款中</span>
                            <span class="label bg-danger" ng-if='og.ordersRefundStatus==4'>平台拒绝</span>
                            <i class="m-l-xs fa fa-question-circle text-muted pos-rlt h6" popover-placement="top"
                               popover="拒绝原因：{{og.ordersRefundReason}}" popover-trigger="mouseenter" ng-if="og.ordersRefundStatus==4"></i>
                        </td>
                        <td>
                            <button class="btn btn-sm btn-info" ng-click="changeGoodsStatus(og.id,og.number)"
                                    ng-if="og.canRefund = 1 && og.isRefundMoney == 0 && og.ordersStatus != 0 && og.ordersStatus != 7 && og.isOpenRebate == 0
                                    && og.ordersRefundStatus!=5">退款</button>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>